home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9995 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  914 b 

  1. Path: user2.mnsinc.com!huang
  2. From: huang@mnsinc.com (Szu-Wen Huang)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: #define "creating" strings ?
  5. Date: 14 Mar 1996 22:23:10 GMT
  6. Organization: Monumental Network Systems
  7. Message-ID: <4ia68f$c5r@news1.mnsinc.com>
  8. References: <Do9tsI.H2t@undergrad.math.uwaterloo.ca>
  9. NNTP-Posting-Host: user2.mnsinc.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Chris Palmer (crpalmer@solo.uwaterloo.ca) wrote:
  13. : I have a problem that I would like to solve using a "feature" of the C
  14. : preprocessor that until now I've never seen or heard of.  A book that we have
  15. : here gives the example:
  16.  
  17. : #define MAKESTRING(x) "x"
  18.  
  19. : which does in fact produce strings that have the value of x substituted.
  20. : [eg: MAKESTRING(foo) gets processed into "foo"].
  21.  
  22. More interestingly, why would anybody want to define a macro like that?
  23. I tried thinking about it, but I can't convince myself that it's useful.
  24. Thoughts?
  25.